/**
 * 项目名称: Topic_682.cpp
 * 项目路径: study/DataStructure/LeetCode/栈/简单
 * 编辑时间: 2024年07月15日08时00分44秒
 * 用   户: 轻尘
 */

#include <bits/stdc++.h>

using namespace std;

int calPoints(vector<string>& operations) {
    stack<int>stk;

    int sum = 0;
    for(auto x:operations){
        if(x == "D"){
            int tmp = stk.top() * 2;
            stk.push(tmp);
        }else if(x == "C"){
            stk.pop();
        }else if(x == "+"){
            int tmp = 0;

            int t1 = stk.top();
            stk.pop();
            int t2 = stk.top();
            stk.pop();

            tmp = t1+t2;
            stk.push(t2);
            stk.push(t1);
            stk.push(tmp);
        }else{
            int tmp = stoi(x);
            stk.push(tmp);
        }
    }

    while (!stk.empty()){
        cout<<stk.top()<<endl;
        sum += stk.top();
        stk.pop();
    }

    return sum;
}

int main() {

    return 0;
}
